﻿using Api.DBUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Api.DAL
{
    /// <summary>
    /// 数据访问类:xzcf_notify
    /// </summary>
    public partial class xzcf_notify
    {
        private string databaseprefix = "eazy_"; //数据库表名前缀
        public xzcf_notify()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from " + databaseprefix + "xzcf_notify");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists_I(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from " + databaseprefix + "xzcf_notify");
            strSql.Append(" where instance_id=@instance_id");
            SqlParameter[] parameters = {
                    new SqlParameter("@instance_id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists_I(int id, int type)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from " + databaseprefix + "xzcf_notify");
            strSql.Append(" where instance_id=@instance_id and type=@type");
            SqlParameter[] parameters = {
                    new SqlParameter("@instance_id", SqlDbType.Int,4),
                    new SqlParameter("@type", SqlDbType.Int,4)
            };
            parameters[0].Value = id;
            parameters[1].Value = type;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Models.xzcf_notify model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        #region 添加主表数据====================
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into " + databaseprefix + "xzcf_notify(");
                        strSql.Append("instance_id,code,number,title,case_tile,content,address,contact,telephone,add_time,sub_time,bm_yijian,type)");
                        strSql.Append(" values (");
                        strSql.Append("@instance_id,@code,@number,@title,@case_tile,@content,@address,@contact,@telephone,@add_time,@sub_time,@bm_yijian,@type)");
                        strSql.Append(";select @@IDENTITY");
                        SqlParameter[] parameters = {
                                    new SqlParameter("@instance_id", SqlDbType.Int,4),
                                    new SqlParameter("@code", SqlDbType.NVarChar,20),
                                    new SqlParameter("@number", SqlDbType.NVarChar,20),
                                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                                    new SqlParameter("@case_tile", SqlDbType.NVarChar,255),
                                    new SqlParameter("@content", SqlDbType.NVarChar,1000),
                                    new SqlParameter("@address", SqlDbType.NVarChar,255),
                                    new SqlParameter("@contact", SqlDbType.NVarChar,20),
                                    new SqlParameter("@telephone", SqlDbType.NVarChar,20),
                                    new SqlParameter("@add_time", SqlDbType.DateTime),
                                    new SqlParameter("@sub_time", SqlDbType.DateTime),
                                    new SqlParameter("@bm_yijian", SqlDbType.Int,4),
                                    new SqlParameter("@type", SqlDbType.Int,4)};
                        parameters[0].Value = model.instance_id;
                        parameters[1].Value = model.code;
                        parameters[2].Value = model.number;
                        parameters[3].Value = model.title;
                        parameters[4].Value = model.case_tile;
                        parameters[5].Value = model.content;
                        parameters[6].Value = model.address;
                        parameters[7].Value = model.contact;
                        parameters[8].Value = model.telephone;
                        parameters[9].Value = model.add_time;
                        parameters[10].Value = model.sub_time;
                        parameters[11].Value = model.bm_yijian;
                        parameters[12].Value = model.type;
                        //添加主表数据
                        object obj = DbHelperSQL.GetSingle(conn, trans, strSql.ToString(), parameters); //带事务
                        model.id = Convert.ToInt32(obj);
                        #endregion

                        #region 修改内容附件==========================
                        //删除已删除的附件
                        new case_attach().DeleteList_I(conn, trans, model.attach, model.instance_id);
                        // 添加/修改附件
                        if (model.attach != null)
                        {
                            StringBuilder strSql4;
                            foreach (Models.case_attach modelt in model.attach)
                            {
                                strSql4 = new StringBuilder();
                                if (modelt.id > 0)
                                {
                                    strSql4.Append("update " + databaseprefix + "case_attach set ");
                                    strSql4.Append("instance_id=@instance_id,");
                                    strSql4.Append("step_id=@step_id,");
                                    strSql4.Append("file_name=@file_name,");
                                    strSql4.Append("file_path=@file_path,");
                                    strSql4.Append("file_size=@file_size,");
                                    strSql4.Append("file_ext=@file_ext,");
                                    strSql4.Append("point=@point,");
                                    strSql4.Append("user_name=@user_name,");
                                    strSql4.Append("article_id=@article_id");
                                    strSql4.Append(" where id=@id");
                                    SqlParameter[] parameters4 = {
                                            new SqlParameter("@instance_id", SqlDbType.Int,4),
                                            new SqlParameter("@step_id", SqlDbType.Int,4),
                                            new SqlParameter("@file_name", SqlDbType.NVarChar,100),
                                            new SqlParameter("@file_path", SqlDbType.NVarChar,255),
                                            new SqlParameter("@file_size", SqlDbType.Int,4),
                                            new SqlParameter("@file_ext", SqlDbType.NVarChar,20),
                                            new SqlParameter("@point", SqlDbType.Int,4),
                                            new SqlParameter("@user_name", SqlDbType.NVarChar,20),
                                            new SqlParameter("@article_id", SqlDbType.Int,4),
                                            new SqlParameter("@id", SqlDbType.Int,4)};
                                    parameters4[0].Value = modelt.instance_id;
                                    parameters4[1].Value = modelt.step_id;
                                    parameters4[2].Value = modelt.file_name;
                                    parameters4[3].Value = modelt.file_path;
                                    parameters4[4].Value = modelt.file_size;
                                    parameters4[5].Value = modelt.file_ext;
                                    parameters4[6].Value = modelt.point;
                                    parameters4[7].Value = modelt.user_name;
                                    parameters4[8].Value = modelt.article_id;
                                    parameters4[9].Value = modelt.id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql4.ToString(), parameters4);
                                }
                                else
                                {
                                    strSql4.Append("insert into " + databaseprefix + "case_attach(");
                                    strSql4.Append("instance_id,step_id,file_name,file_path,file_size,file_ext,down_num,point,user_name,article_id)");
                                    strSql4.Append(" values (");
                                    strSql4.Append("@instance_id,@step_id,@file_name,@file_path,@file_size,@file_ext,@down_num,@point,@user_name,@article_id)");
                                    SqlParameter[] parameters4 = {
                                            new SqlParameter("@instance_id", SqlDbType.Int,4),
                                            new SqlParameter("@step_id", SqlDbType.Int,4),
                                            new SqlParameter("@file_name", SqlDbType.NVarChar,100),
                                            new SqlParameter("@file_path", SqlDbType.NVarChar,255),
                                            new SqlParameter("@file_size", SqlDbType.Int,4),
                                            new SqlParameter("@file_ext", SqlDbType.NVarChar,20),
                                            new SqlParameter("@down_num", SqlDbType.Int,4),
                                            new SqlParameter("@point", SqlDbType.Int,4),
                                            new SqlParameter("@user_name", SqlDbType.NVarChar,20),
                                            new SqlParameter("@article_id", SqlDbType.Int,4)};
                                    parameters4[0].Value = modelt.instance_id;
                                    parameters4[1].Value = modelt.step_id;
                                    parameters4[2].Value = modelt.file_name;
                                    parameters4[3].Value = modelt.file_path;
                                    parameters4[4].Value = modelt.file_size;
                                    parameters4[5].Value = modelt.file_ext;
                                    parameters4[6].Value = modelt.down_num;
                                    parameters4[7].Value = modelt.point;
                                    parameters4[8].Value = modelt.user_name;
                                    parameters4[9].Value = modelt.article_id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql4.ToString(), parameters4);
                                }
                            }
                        }
                        #endregion

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return 0;
                    }
                }
            }
            return model.id;
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Models.xzcf_notify model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        #region 修改主表数据==========================
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("update " + databaseprefix + "xzcf_notify set ");
                        strSql.Append("instance_id=@instance_id,");
                        strSql.Append("code=@code,");
                        strSql.Append("number=@number,");
                        strSql.Append("title=@title,");
                        strSql.Append("case_tile=@case_tile,");
                        strSql.Append("content=@content,");
                        strSql.Append("address=@address,");
                        strSql.Append("contact=@contact,");
                        strSql.Append("telephone=@telephone,");
                        strSql.Append("add_time=@add_time,");
                        strSql.Append("sub_time=@sub_time,");
                        strSql.Append("bm_yijian=@bm_yijian,");
                        strSql.Append("type=@type");
                        strSql.Append(" where id=@id");
                        SqlParameter[] parameters = {
                                    new SqlParameter("@instance_id", SqlDbType.Int,4),
                                    new SqlParameter("@code", SqlDbType.NVarChar,20),
                                    new SqlParameter("@number", SqlDbType.NVarChar,20),
                                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                                    new SqlParameter("@case_tile", SqlDbType.NVarChar,255),
                                    new SqlParameter("@content", SqlDbType.NVarChar,1000),
                                    new SqlParameter("@address", SqlDbType.NVarChar,255),
                                    new SqlParameter("@contact", SqlDbType.NVarChar,20),
                                    new SqlParameter("@telephone", SqlDbType.NVarChar,20),
                                    new SqlParameter("@add_time", SqlDbType.DateTime),
                                    new SqlParameter("@sub_time", SqlDbType.DateTime),
                                    new SqlParameter("@bm_yijian", SqlDbType.Int,4),
                                    new SqlParameter("@type", SqlDbType.Int,4),
                                    new SqlParameter("@id", SqlDbType.Int,4)};
                        parameters[0].Value = model.instance_id;
                        parameters[1].Value = model.code;
                        parameters[2].Value = model.number;
                        parameters[3].Value = model.title;
                        parameters[4].Value = model.case_tile;
                        parameters[5].Value = model.content;
                        parameters[6].Value = model.address;
                        parameters[7].Value = model.contact;
                        parameters[8].Value = model.telephone;
                        parameters[9].Value = model.add_time;
                        parameters[10].Value = model.sub_time;
                        parameters[11].Value = model.bm_yijian;
                        parameters[12].Value = model.type;
                        parameters[13].Value = model.id;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                        #endregion

                        #region 修改内容附件==========================
                        //删除已删除的附件
                        new case_attach().DeleteList_I(conn, trans, model.attach, model.instance_id);
                        // 添加/修改附件
                        if (model.attach != null)
                        {
                            StringBuilder strSql4;
                            foreach (Models.case_attach modelt in model.attach)
                            {
                                strSql4 = new StringBuilder();
                                if (modelt.id > 0)
                                {
                                    strSql4.Append("update " + databaseprefix + "case_attach set ");
                                    strSql4.Append("instance_id=@instance_id,");
                                    strSql4.Append("step_id=@step_id,");
                                    strSql4.Append("file_name=@file_name,");
                                    strSql4.Append("file_path=@file_path,");
                                    strSql4.Append("file_size=@file_size,");
                                    strSql4.Append("file_ext=@file_ext,");
                                    strSql4.Append("point=@point,");
                                    strSql4.Append("user_name=@user_name,");
                                    strSql4.Append("article_id=@article_id");
                                    strSql4.Append(" where id=@id");
                                    SqlParameter[] parameters4 = {
                                            new SqlParameter("@instance_id", SqlDbType.Int,4),
                                            new SqlParameter("@step_id", SqlDbType.Int,4),
                                            new SqlParameter("@file_name", SqlDbType.NVarChar,100),
                                            new SqlParameter("@file_path", SqlDbType.NVarChar,255),
                                            new SqlParameter("@file_size", SqlDbType.Int,4),
                                            new SqlParameter("@file_ext", SqlDbType.NVarChar,20),
                                            new SqlParameter("@point", SqlDbType.Int,4),
                                            new SqlParameter("@user_name", SqlDbType.NVarChar,20),
                                            new SqlParameter("@article_id", SqlDbType.Int,4),
                                            new SqlParameter("@id", SqlDbType.Int,4)};
                                    parameters4[0].Value = modelt.instance_id;
                                    parameters4[1].Value = modelt.step_id;
                                    parameters4[2].Value = modelt.file_name;
                                    parameters4[3].Value = modelt.file_path;
                                    parameters4[4].Value = modelt.file_size;
                                    parameters4[5].Value = modelt.file_ext;
                                    parameters4[6].Value = modelt.point;
                                    parameters4[7].Value = modelt.user_name;
                                    parameters4[8].Value = modelt.article_id;
                                    parameters4[9].Value = modelt.id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql4.ToString(), parameters4);
                                }
                                else
                                {
                                    strSql4.Append("insert into " + databaseprefix + "case_attach(");
                                    strSql4.Append("instance_id,step_id,file_name,file_path,file_size,file_ext,down_num,point,user_name,article_id)");
                                    strSql4.Append(" values (");
                                    strSql4.Append("@instance_id,@step_id,@file_name,@file_path,@file_size,@file_ext,@down_num,@point,@user_name,@article_id)");
                                    SqlParameter[] parameters4 = {
                                            new SqlParameter("@instance_id", SqlDbType.Int,4),
                                            new SqlParameter("@step_id", SqlDbType.Int,4),
                                            new SqlParameter("@file_name", SqlDbType.NVarChar,100),
                                            new SqlParameter("@file_path", SqlDbType.NVarChar,255),
                                            new SqlParameter("@file_size", SqlDbType.Int,4),
                                            new SqlParameter("@file_ext", SqlDbType.NVarChar,20),
                                            new SqlParameter("@down_num", SqlDbType.Int,4),
                                            new SqlParameter("@point", SqlDbType.Int,4),
                                            new SqlParameter("@user_name", SqlDbType.NVarChar,20),
                                            new SqlParameter("@article_id", SqlDbType.Int,4)};
                                    parameters4[0].Value = modelt.instance_id;
                                    parameters4[1].Value = modelt.step_id;
                                    parameters4[2].Value = modelt.file_name;
                                    parameters4[3].Value = modelt.file_path;
                                    parameters4[4].Value = modelt.file_size;
                                    parameters4[5].Value = modelt.file_ext;
                                    parameters4[6].Value = modelt.down_num;
                                    parameters4[7].Value = modelt.point;
                                    parameters4[8].Value = modelt.user_name;
                                    parameters4[9].Value = modelt.article_id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql4.ToString(), parameters4);
                                }
                            }
                        }
                        #endregion

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return false;
                    }
                }
            }
            return true;
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from " + databaseprefix + "xzcf_notify ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from " + databaseprefix + "xzcf_notify ");
            strSql.Append(" where id in (" + idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Models.xzcf_notify GetModel(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,instance_id,code,number,title,case_tile,content,address,contact,telephone,add_time,sub_time,bm_yijian,type  from " + databaseprefix + "xzcf_notify ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            Models.xzcf_notify model = new Models.xzcf_notify();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Models.xzcf_notify GetModel_I(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,instance_id,code,number,title,case_tile,content,address,contact,telephone,add_time,sub_time,bm_yijian,type  from " + databaseprefix + "xzcf_notify ");
            strSql.Append(" where instance_id=@instance_id");
            SqlParameter[] parameters = {
                    new SqlParameter("@instance_id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            Models.xzcf_notify model = new Models.xzcf_notify();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Models.xzcf_notify GetModel_I(int id, int type)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,instance_id,code,number,title,case_tile,content,address,contact,telephone,add_time,sub_time,bm_yijian,type  from " + databaseprefix + "xzcf_notify ");
            strSql.Append(" where instance_id=@instance_id and type=@type");
            SqlParameter[] parameters = {
                    new SqlParameter("@instance_id", SqlDbType.Int,4),
                    new SqlParameter("@type", SqlDbType.Int,4)
            };
            parameters[0].Value = id;
            parameters[1].Value = type;

            Models.xzcf_notify model = new Models.xzcf_notify();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }

        public Models.xzcf_notify DataRowToModel(DataRow row)
        {
            Models.xzcf_notify model = new Models.xzcf_notify();
            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["instance_id"] != null && row["instance_id"].ToString() != "")
                {
                    model.instance_id = int.Parse(row["instance_id"].ToString());
                }
                if (row["code"] != null)
                {
                    model.code = row["code"].ToString();
                }
                if (row["number"] != null)
                {
                    model.number = row["number"].ToString();
                }
                if (row["title"] != null)
                {
                    model.title = row["title"].ToString();
                }
                if (row["case_tile"] != null)
                {
                    model.case_tile = row["case_tile"].ToString();
                }
                if (row["content"] != null)
                {
                    model.content = row["content"].ToString();
                }
                if (row["address"] != null)
                {
                    model.address = row["address"].ToString();
                }
                if (row["contact"] != null)
                {
                    model.contact = row["contact"].ToString();
                }
                if (row["telephone"] != null)
                {
                    model.telephone = row["telephone"].ToString();
                }
                if (row["add_time"] != null && row["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(row["add_time"].ToString());
                }
                if (row["sub_time"] != null && row["sub_time"].ToString() != "")
                {
                    model.sub_time = DateTime.Parse(row["sub_time"].ToString());
                }
                if (row["bm_yijian"] != null && row["bm_yijian"].ToString() != "")
                {
                    model.bm_yijian = int.Parse(row["bm_yijian"].ToString());
                }
                if (row["type"] != null && row["type"].ToString() != "")
                {
                    model.type = int.Parse(row["type"].ToString());
                }

                model.attach = new case_attach().GetList_I(model.instance_id.ToString());
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,instance_id,code,number,title,case_tile,content,address,contact,telephone,add_time,sub_time,bm_yijian,type  ");
            strSql.Append(" FROM " + databaseprefix + "xzcf_notify ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" id,instance_id,code,number,title,case_tile,content,address,contact,telephone,add_time,sub_time,bm_yijian,type ");
            strSql.Append(" FROM " + databaseprefix + "xzcf_notify ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM " + databaseprefix + "xzcf_notify ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.id desc");
            }
            strSql.Append(")AS Row, T.*  from " + databaseprefix + "xzcf_notify T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }
        #endregion
    }
}
